import random
import pickle
from argparse import ArgumentParser


def main(option):
    random.seed(option.random_seed)
    source_vocab = pickle.load(open(option.source_vocab, 'rb'))
    samples = random.sample(source_vocab['id2word'], option.num_samples)

    with open(option.output_file, 'w') as f:
        for word in samples:
            f.write(word + '\n')


if __name__ == '__main__':
    parser = ArgumentParser()
    parser.add_argument('--random_seed', type=int, default=19950125)
    parser.add_argument('--num_samples', type=int, default=100)
    parser.add_argument('--source_vocab', type=str, default='output/fbis.en.pkl')
    parser.add_argument('--output_file', type=str, default='output/input.txt')
    option = parser.parse_args()

    main(option)
